package com.zk.atm.utils;

import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
/**
 * 
 * @author zengqun
 * @remark 对相关列进行加密,解密
 * @date 2012-10-22
 * @version 1.0
 *
 */
public class EncryptUtil {

	/** * BASE64加密解密 */
		/** * BASE64解密 * @param key * @return * @throws Exception */
		public static byte[] decryptBASE64(String key) throws Exception {
			return (new BASE64Decoder()).decodeBuffer(key);
		}

		/** * BASE64加密 * @param key * @return * @throws Exception */
		public static String encryptBASE64(byte[] key) throws Exception {
			return (new BASE64Encoder()).encodeBuffer(key);
		}

		public static void main(String[] args) throws Exception {
			String data = EncryptUtil.encryptBASE64("http://aub.iteye.com/".getBytes());
			System.out.println("加密后：" + data);
			byte[] byteArray = EncryptUtil.decryptBASE64(data);
			System.out.println("解密后：" + new String(byteArray));
		}

}
